package com.mmd.exception;

import com.mmd.bean.CODE;

/**
 * @Author cyq
 * @Date 2019/8/21 22:19
 * @Description
 **/

public class GameException extends RuntimeException {
    private static final long serialVersionUID = -3953266288895754521L;
    private CODE error;
    private long param = 0L;
    private Object paramObj = null;

    public GameException(CODE dataNull) {
        super(dataNull == null ? "" : dataNull.getMsg());
        this.error = dataNull;
    }

    public GameException(CODE error, long param) {
        super(error == null ? "" : error.getMsg());
        this.error = error;
        this.param = param;
    }

    public GameException(CODE error, Object paramObj) {
        super(error == null ? "" : error.getMsg());
        this.error = error;
        this.paramObj = paramObj;
    }

    public int getCode() {
        return this.error == null ? CODE.SYSTEMERROR.getIndex() : this.error.getIndex();
    }

    public String getMsg() {
        return this.error == null ? CODE.SYSTEMERROR.getMsg() : this.error.getMsg();
    }

    public long getParam() {
        return this.param;
    }

    public Object getParamObj() {
        return this.paramObj;
    }
}
